/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package uimigration.uipositionning.impl;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;

import org.eclipse.emf.ecore.impl.EFactoryImpl;

import org.eclipse.emf.ecore.plugin.EcorePlugin;

import uimigration.uipositionning.*;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Factory</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class UipositionningFactoryImpl extends EFactoryImpl implements
		UipositionningFactory {
	/**
	 * Creates the default factory implementation.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public static UipositionningFactory init() {
		try {
			UipositionningFactory theUipositionningFactory = (UipositionningFactory)EPackage.Registry.INSTANCE.getEFactory("http://uipositionning/1.0"); 
			if (theUipositionningFactory != null) {
				return theUipositionningFactory;
			}
		}
		catch (Exception exception) {
			EcorePlugin.INSTANCE.log(exception);
		}
		return new UipositionningFactoryImpl();
	}

	/**
	 * Creates an instance of the factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public UipositionningFactoryImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public EObject create(EClass eClass) {
		switch (eClass.getClassifierID()) {
			case UipositionningPackage.ABSOLUTE: return createAbsolute();
			case UipositionningPackage.LEFT_TO: return createLeftTo();
			case UipositionningPackage.RIGHT_TO: return createRightTo();
			case UipositionningPackage.TOP_TO: return createTopTo();
			case UipositionningPackage.DOWN_TO: return createDownTo();
			case UipositionningPackage.ATTACHED_TO: return createAttachedTo();
			case UipositionningPackage.NESTED_IN: return createNestedIn();
			default:
				throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object createFromString(EDataType eDataType, String initialValue) {
		switch (eDataType.getClassifierID()) {
			case UipositionningPackage.NESTED_POSITION_TYPE:
				return createNestedPositionTypeFromString(eDataType, initialValue);
			default:
				throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String convertToString(EDataType eDataType, Object instanceValue) {
		switch (eDataType.getClassifierID()) {
			case UipositionningPackage.NESTED_POSITION_TYPE:
				return convertNestedPositionTypeToString(eDataType, instanceValue);
			default:
				throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Absolute createAbsolute() {
		AbsoluteImpl absolute = new AbsoluteImpl();
		return absolute;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public LeftTo createLeftTo() {
		LeftToImpl leftTo = new LeftToImpl();
		return leftTo;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public RightTo createRightTo() {
		RightToImpl rightTo = new RightToImpl();
		return rightTo;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public TopTo createTopTo() {
		TopToImpl topTo = new TopToImpl();
		return topTo;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public DownTo createDownTo() {
		DownToImpl downTo = new DownToImpl();
		return downTo;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public AttachedTo createAttachedTo() {
		AttachedToImpl attachedTo = new AttachedToImpl();
		return attachedTo;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NestedIn createNestedIn() {
		NestedInImpl nestedIn = new NestedInImpl();
		return nestedIn;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NestedPositionType createNestedPositionTypeFromString(
			EDataType eDataType, String initialValue) {
		NestedPositionType result = NestedPositionType.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertNestedPositionTypeToString(EDataType eDataType,
			Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public UipositionningPackage getUipositionningPackage() {
		return (UipositionningPackage)getEPackage();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @deprecated
	 * @generated
	 */
	@Deprecated
	public static UipositionningPackage getPackage() {
		return UipositionningPackage.eINSTANCE;
	}

} //UipositionningFactoryImpl
